

//默认显示业务模块菜单
loadMenu("business");

var setting = {
    //开启简单JSON格式
    data: {
        simpleData: {
            enable: true
        }
    },
    //给菜单节点绑定点击事件
    callback: {
        onClick: function (event, treeId, treeNode) {
            if (treeNode.action) { //非顶级菜单才执行访问界面
                var url= "/"+treeNode.action+".do";
                //重新显示当前的位置 父菜单 当前菜单
                $("#here_area").html("当前位置：" + treeNode.getParentNode().name + " > " + treeNode.name);
                //显示到网页的右边
                $("#rightMain").prop("src", url);
            }
        }
    },
    //异步加载菜单
    async: {
        enable: true,
        url: "/systemMenu/getMenusBySn.do",
        autoParam: ["sn=menuSn"]
    }
};

//菜单树的节点
var zNodes = {
    systemManage: [
        {id:1, pId:0, name: "系统模块", sn: "system", isParent: true}
    ],
    business: [
        {id:2, pId:0, name: "业务模块", sn: "business", isParent: true}
    ],
    charts: [
        {id:3, pId:0, name: "报表模块", sn: "chart", isParent: true}
    ]
};

//加载菜单,显示菜单树
function loadMenu(root) {
    $.fn.zTree.init($("#dleft_tab1"), setting, zNodes[root]);
}